Chapter 20: Inference for comparing two independent means

Overview

  • 20.1 Randomization test for the difference in means
    • 20.1.1 Observed data
    • 20.1.2 Variability of the statistic
    • 20.1.3 Observed statistic vs. null statistics
  • 20.2 Bootstrap confidence interval for the difference in means
    • 20.2.1 Observed data
    • 20.2.2 Variability of the statistic
  • 20.3 Mathematical model for testing the difference in means
    • 20.3.1 Observed data
    • 20.3.2 Variability of the statistic
    • 20.3.3 Observed statistic vs. null statistics
  • 20.4 Mathematical model for estimating the difference in means
    • 20.4.1 Observed data
    • 20.4.2 Variability of the statistic

20.1 Randomization test for the difference in means

  • Null Hypothesis: No association
    • \(H_0: \mu_1 - \mu_2 = 0\)
  • Alternative Hypothesis: Some association
    • \(H_A: \mu_1 - \mu_2 \neq 0\)

20.1.1 Observed data

20.1.2 Variability of the statistic

20.1.3 Observed statistic vs. null statistics

Sleep Deprivation

Sleep Deprivation

Researchers Stickgold, James, and Hobson investigated delayed effects of sleep deprivation on learning in a study published in Nature Neuroscience (2000). The goal of the study was to see whether the improvement scores tend to be higher for the unrestricted sleep treatment than for the sleep deprivation treatment.

Statistics and Hypotheses

Unrestricted-sleep group’s improvement scores (milliseconds):

  • 25.20, 14.50, -7.00, 12.60, 34.50, 45.60, 11.60, 18.60, 12.10, 30.50

Sleep-deprived group’s improvement scores (milliseconds):

  • -10.70, 4.50, 2.20, 21.30, -14.70, -10.70, 9.60, 2.40, 21.80, 7.20, 10.00

\[ \bar{x}_\text{unrestricted} - \bar{x}_\text{deprived} = 15.92 \\[0.2in] \begin{align} H_0: \mu_\text{unrestricted} - \mu_\text{deprived} &= 0 \\ H_a: \mu_\text{unrestricted} - \mu_\text{deprived} &\neq 0 \end{align} \]

Simulation with Cards

  • Unrestricted-sleep: 25.20, 14.50, -7.00, 12.60, 34.50, 45.60, 11.60, 18.60, 12.10, 30.50
  • Sleep-deprived: -10.70, 4.50, 2.20, 21.30, -14.70, -10.70, 9.60, 2.40, 21.80, 7.20, 10.00

Because the null hypothesis asserts that improvement score is not associated with sleep condition, we will assume that the 21 subjects would have had exactly the same improvement scores as they did, regardless of which sleep condition group (unrestricted or deprived) the subject had been assigned.

  • 21 cards; numbers on cards
  • Deal into two piles: 10 and 11

Group Activity

  1. Open the Multiple Means applet. Check the Show Shuffle Options box, select the Plot display, and press Shuffle Responses. Describe what happens when you press Shuffle Responses. How is the location of the next point on the dotplot determined?

  2. Use a total of at least 1000 repetitions, and record a p-value. Record a sentence summarizing the strength of evidence in the context of this study.

  3. Record an SE 95% confidence interval for \(\mu_\text{unrestricted} - \mu_\text{deprived}\). Is zero a plausible value?

20.2 Bootstrap confidence interval for the difference in means

20.2.2 Variability of the statistic

20.3 Mathematical model for testing the difference in means

The Central Limit Theorem applies to differences in means as well. Conditions:

  • Independent observations
  • Large samples without extreme outliers, or smaller samples with symmetric populations.

20.3.1 Observed data

Data on birth weight and mother smoking habit:

births14 %>%
  group_by(habit) %>%
  summarize(xbar = mean(weight),
            s = sd(weight),
            n = n())
# A tibble: 3 × 4
  habit      xbar     s     n
  <chr>     <dbl> <dbl> <int>
1 nonsmoker  7.27  1.23   867
2 smoker     6.68  1.60   114
3 <NA>       7.05  1.91    19

Hypotheses

  • \(H_0 :\) There is no difference in average birth weight for newborns from mothers who did and did not smoke.
    • \(\mu_n - \mu_s = 0\)
  • \(H_A:\) There is some difference in average newborn weights from mothers who did and did not smoke.
    • \(\mu_n - \mu_s \neq 0\)

20.3.3 Observed statistic vs. null statistics

T-statistic for independent means:

\[ T = \frac{(\bar{x}_1 - \bar{x}_2) - 0}{\sqrt{s_1^2/n_1 + s_2^2/n_2}} \] Degrees of freedom equals minimum of \(n_1-1\) and \(n_2-1\).

Group Exercise

# A tibble: 2 × 4
  habit      xbar     s     n
  <chr>     <dbl> <dbl> <int>
1 nonsmoker  7.27  1.23   867
2 smoker     6.68  1.6    114
  1. Compute a T-score and a P-value for this hypothesis test.

  2. Write a sentence interpreting your conclusion in the context of the study.

Using the mathematical model in R

Glimpse the data

glimpse(births14)
Rows: 1,000
Columns: 13
$ fage           <int> 34, 36, 37, NA, 32, 32, 37, 29, 30, 29, 30, 34, 28, 28, 32, 24, 29, 35, 25,…
$ mage           <dbl> 34, 31, 36, 16, 31, 26, 36, 24, 32, 26, 34, 27, 22, 31, 25, 20, 32, 33, 26,…
$ mature         <chr> "younger mom", "younger mom", "mature mom", "younger mom", "younger mom", "…
$ weeks          <dbl> 37, 41, 37, 38, 36, 39, 36, 40, 39, 39, 42, 40, 40, 39, 34, 37, 38, 41, 44,…
$ premie         <chr> "full term", "full term", "full term", "full term", "premie", "full term", …
$ visits         <dbl> 14, 12, 10, NA, 12, 14, 10, 13, 15, 11, 14, 16, 20, 15, 20, 10, 12, 15, 16,…
$ gained         <dbl> 28, 41, 28, 29, 48, 45, 20, 65, 25, 22, 40, 30, 31, NA, 25, 70, 22, 38, 20,…
$ weight         <dbl> 6.96, 8.86, 7.51, 6.19, 6.75, 6.69, 6.13, 6.74, 8.94, 9.12, 8.91, 8.00, 7.2…
$ lowbirthweight <chr> "not low", "not low", "not low", "not low", "not low", "not low", "not low"…
$ sex            <chr> "male", "female", "female", "male", "female", "female", "female", "male", "…
$ habit          <chr> "nonsmoker", "nonsmoker", "nonsmoker", "nonsmoker", "nonsmoker", "nonsmoker…
$ marital        <chr> "married", "married", "married", "not married", "married", "married", "marr…
$ whitemom       <chr> "white", "white", "not white", "white", "white", "white", "white", "white",…

Formulas in R

  • Response ~ Explanatory
  • weight ~ habit

Two-sample t-test in R

t.test(weight ~ habit, data = births14)

    Welch Two Sample t-test

data:  weight by habit
t = 3.8166, df = 131.31, p-value = 0.0002075
alternative hypothesis: true difference in means between group nonsmoker and group smoker is not equal to 0
95 percent confidence interval:
 0.2854852 0.8998751
sample estimates:
mean in group nonsmoker    mean in group smoker 
               7.269873                6.677193 

Confidence interval interpretation

We are 95% confident that the mean weight of babies born to nonsmokers is between 0.3 and 0.9 pounds more than the mean weight of babies born to smokers.